import axios from 'axios'
import React from 'react'
import { Uploader } from 'react-vant'
const Index = () => {

	const upload = async (file: File) => {
		try {
			const body = new FormData()
			body.append('file', file)

			const resp = await axios.post('/upload', body)
			console.log(resp.data);
			
			return resp.data
		} catch (error) {
			return { url: `demo_path/${file.name}` }
		}
	}
	return (
		<div>
			<Uploader upload={upload} />
		</div>
	)
}

export default Index;